home *** CD-ROM | disk | FTP | other *** search
/ Animation How-To / Animation How-to CD.iso / PLY / CHAPTER5 / TUG / TUGN.BAS < prev    next >
BASIC Source File  |  1994-01-01  |  3KB  |  104 lines

  1. OPEN "tugn.pi" FOR OUTPUT AS #1
  2.  
  3. PRINT #1, "start_frame 0"
  4. PRINT #1, "end_frame 35"
  5. PRINT #1, "total_frames 36"
  6. PRINT #1,
  7. PRINT #1, "outfile "; CHR$(34); "tug"; CHR$(34)
  8. PRINT #1,
  9. PRINT #1, "include "; CHR$(34); "\ply\colors.inc"; CHR$(34)
  10. PRINT #1,
  11. PRINT #1, "viewpoint {"
  12. PRINT #1, "   from <10,10,-15>"
  13. PRINT #1, "   at <2.5,2.5,2.5>"
  14. PRINT #1, "   up <0,1,0>"
  15. PRINT #1, "   angle 30"
  16. PRINT #1, "   resolution 160,100"
  17. PRINT #1, "   aspect 1.43"
  18. PRINT #1, "   }"
  19. PRINT #1, "background SkyBlue"
  20. PRINT #1,
  21. PRINT #1, "define pi 3.14159"
  22. PRINT #1, "define angle_nor frame*2*pi/total_frames"
  23. PRINT #1,
  24. PRINT #1, "define ph1 0*pi/3"
  25. PRINT #1, "define ph2 2*pi/3"
  26. PRINT #1, "define ph3 4*pi/3"
  27. PRINT #1,
  28. PRINT #1, "// little orbital repellers"
  29. PRINT #1,
  30. PRINT #1, "define  fx1  2.5 + 5 * COS(angle_nor+ph1)"
  31. PRINT #1, "define  fy1  2.5 + 5 * SIN(angle_nor+ph1)"
  32. PRINT #1, "define  fz1  2.5"
  33. PRINT #1,
  34. PRINT #1, "define  fx2  2.5 + 5 * COS(angle_nor+ph2)"
  35. PRINT #1, "define  fy2  2.5"
  36. PRINT #1, "define  fz2  2.5 + 5 * SIN(angle_nor+ph2)"
  37. PRINT #1,
  38. PRINT #1, "define  fx3  2.5"
  39. PRINT #1, "define  fy3  2.5 + 5 * COS(angle_nor+ph3)"
  40. PRINT #1, "define  fz3  2.5 + 5 * SIN(angle_nor+ph3)"
  41. PRINT #1,
  42. PRINT #1, "define  fx4 0"
  43. PRINT #1, "define  fy4 0"
  44. PRINT #1, "define  fz4 0"
  45. PRINT #1,
  46. PRINT #1, "define  f  1"
  47. PRINT #1, "define  p  2"
  48. PRINT #1,
  49. PRINT #1, "object { "
  50. PRINT #1, "   sphere <fx1,fy1,fz1>,0.2"
  51. PRINT #1, "   shading_flags 32 + 8 + 4 + 2 +1"
  52. PRINT #1, "   shiny_yellow"
  53. PRINT #1, "}"
  54. PRINT #1,
  55. PRINT #1, "object { "
  56. PRINT #1, "   sphere <fx2,fy2,fz2>,0.2"
  57. PRINT #1, "   shading_flags 32 + 8 + 4 + 2 +1"
  58. PRINT #1, "   shiny_blue"
  59. PRINT #1, "}"
  60. PRINT #1,
  61. PRINT #1, "object { "
  62. PRINT #1, "   sphere <fx3,fy3,fz3>,0.2"
  63. PRINT #1, "   shading_flags 32 + 8 + 4 + 2 +1"
  64. PRINT #1, "   shiny_red"
  65. PRINT #1, "}"
  66. PRINT #1,
  67. PRINT #1, "light <0.8,0.8,0>, <fx1,fy1,fz1>"
  68. PRINT #1, "light <0,0,0.8>, <fx2,fy2,fz2>"
  69. PRINT #1, "light <0.8,0,0>, <fx3,fy3,fz3>"
  70. PRINT #1,
  71. PRINT #1, "light white*0.5, <9,15,-10>"
  72. PRINT #1,
  73. PRINT #1, "///////////////////////MAIN LOOP/////////////////////////////"
  74. PRINT #1,
  75.  
  76. FOR a = 0 TO 5
  77. FOR b = 0 TO 5
  78. FOR c = 0 TO 5
  79.  
  80. a$ = RIGHT$("00" + LTRIM$(STR$(a)), 2)
  81. b$ = RIGHT$("00" + LTRIM$(STR$(b)), 2)
  82. c$ = RIGHT$("00" + LTRIM$(STR$(c)), 2)
  83. x$ = "x" + a$ + b$ + c$
  84. y$ = "y" + a$ + b$ + c$
  85. z$ = "z" + a$ + b$ + c$
  86.  
  87. PRINT #1, "define a "; a$
  88. PRINT #1, "define b "; b$
  89. PRINT #1, "define c "; c$
  90. PRINT #1,
  91. PRINT #1, "include "; CHR$(34); "tug.inc"; CHR$(34)
  92. PRINT #1,
  93. PRINT #1, "define "; x$; " a + f1 * drx1 + f2 * drx2 + f3 * drx3"
  94. PRINT #1, "define "; y$; " b + f1 * dry1 + f2 * dry2 + f3 * dry3"
  95. PRINT #1, "define "; z$; " c + f1 * drz1 + f2 * drz2 + f3 * drz3"
  96. PRINT #1,
  97. PRINT #1, USING "object { sphere <\     \,\     \,\     \>,0.2+f1+f2+f3 reflective__white }"; x$; y$; z$
  98.  
  99. NEXT c
  100. NEXT b
  101. NEXT a
  102. CLOSE #1
  103.  
  104.